
.data-analysis {
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1vmin;
  background: #f5f7fa;

  .filter-section {

    background: #fff;
    padding: 1.5vmin;
    border-radius: 8px;
    margin-bottom: 1vh;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
    overflow-x: auto;

    .filter-form {
      display: flex;
      flex-wrap: wrap;
      gap: 1vw 1.5vw;
      align-items: center;

      .el-form-item {
        margin-bottom: 8px;
        margin-right: 0;
        flex-shrink: 0;

        .el-select {
          width: clamp(120px, 12vw, 180px); /* 响应式宽度 */
        }
      }
    }

    // 小屏幕时允许换行
    @media screen and (max-width: 768px) {
      .filter-form {
        flex-wrap: wrap; /* 小屏幕时允许换行 */
        min-width: auto;

        .el-form-item {
          .el-select {
            width: 140px;
          }
        }
      }
    }
  }

  .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;

 


    .data-cards {
      display: grid;
      grid-template-columns: repeat(6, 1fr);
      gap: 10px;
      margin-bottom: 10px;

      .data-card {
        background: #fff;
        padding: 15px;
        border-radius: 8px;
        display: flex;
        align-items: center;
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);

        .card-icon {
          width: 40px;
          height: 40px;
          border-radius: 8px;
          display: flex;
          align-items: center;
          justify-content: center;
          margin-right: 10px;

          i {
            font-size: 20px;
            color: #fff;
          }

          &.blue { background: linear-gradient(135deg, #409EFF, #3a8ee6); }
          &.red { background: linear-gradient(135deg, #F56C6C, #e64242); }
          &.orange { background: linear-gradient(135deg, #E6A23C, #d48b1c); }
          &.green { background: linear-gradient(135deg, #67C23A, #4e9e2e); }
          &.purple { background: linear-gradient(135deg, #909399, #73767a); }
          &.gold { background: linear-gradient(135deg, #FFBA00, #FF9000); }
        }

        .card-content {
          flex: 1;
          min-width: 0;

          .card-value {
            font-size: 18px;
            font-weight: bold;
            color: #303133;
            line-height: 1.2;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }

          .card-label {
            font-size: 12px;
            color: #909399;
            margin-top: 2px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
          }
        }
      }
    }

    // 平板适配 (768px - 1024px)
    @media screen and (max-width: 1024px) {
      .data-cards {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;

        .data-card {
          padding: 12px;

          .card-icon {
            width: 35px;
            height: 35px;
            margin-right: 8px;

            i {
              font-size: 18px;
            }
          }

          .card-content {
            .card-value {
              font-size: 16px;
            }

            .card-label {
              font-size: 11px;
            }
          }
        }
      }
    }

    // 手机适配 (小于768px)
    @media screen and (max-width: 768px) {
      .data-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;

        .data-card {
          padding: 10px;

          .card-icon {
            width: 30px;
            height: 30px;
            margin-right: 6px;

            i {
              font-size: 16px;
            }
          }

          .card-content {
            .card-value {
              font-size: 14px;
            }

            .card-label {
              font-size: 10px;
            }
          }
        }
      }
    }

    // 超小屏幕适配 (小于480px)
    @media screen and (max-width: 480px) {
      .data-cards {
        grid-template-columns: 1fr;
        gap: 5px;

        .data-card {
          padding: 8px;

          .card-icon {
            width: 25px;
            height: 25px;
            margin-right: 5px;

            i {
              font-size: 14px;
            }
          }

          .card-content {
            .card-value {
              font-size: 12px;
            }

            .card-label {
              font-size: 9px;
            }
          }
        }
      }
    }

    .chart-container {
      flex: 1;
      display: flex;

      width: 100%;
      box-sizing: border-box;
   

      .charts-section {
        flex: 1;
        display: flex;
        flex-direction: column;
      
        min-height: 0;
        height: 100%;
        width: 100%;
        box-sizing: border-box;

        .chart-row-top {
          display: flex;
          gap: 1vw;
          height: 40vh; /* 固定高度 */
          min-height: 300px; /* 最小高度保证 */
          width: 100%;
          box-sizing: border-box;
          flex-shrink: 0; /* 不收缩 */
        }

        .chart-row-bottom {
          display: flex;
          gap: 1vw;
          min-height: 250px; /* 最小高度保证 */
          width: 100%;
          box-sizing: border-box;
          margin-top: 10px;
        }

        .chart-item {
          flex: 1;
          background: #fff;
          padding: 1.5vmin; /* 使用视口最小单位 */
          border-radius: 8px;
          box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
          display: flex;
          flex-direction: column;
          min-width: 20vw; /* 使用视口宽度单位 */
          box-sizing: border-box;
          position: relative;

          .chart-title {
            font-size: clamp(12px, 1.4vmin, 16px); /* 响应式字体大小 */
            font-weight: bold;
            color: #303133;
            margin-bottom: 1vmin;
            flex-shrink: 0;
          }

          .chart-subtitle {
            font-size: clamp(10px, 1.2vmin, 14px);
            color: #909399;
            margin-top: 0.5vmin;
            flex-shrink: 0;
          }

          .chart {
            flex: 1; /* 让图表占据剩余所有空间 */
            min-height: 200px; /* 使用视口高度确保最小可用空间 */
            width: 100%;
            position: relative;
          }
        }

        /* 上排两个图表项需要限制宽度 */
        .chart-row-top .chart-item {
          max-width: calc(50% - 5px); /* 确保两个图表平分空间 */
        }

        /* 下排单个图表项占满宽度 */
      
      }

      .ranking-section {
        width: 280px;
        background: #fff;
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.05);
        display: flex;
        flex-direction: column;

        .section-title {
          display: flex;
          align-items: center;
          margin-bottom: 15px;
          font-size: 14px;
          font-weight: bold;
          color: #303133;

          .el-icon-question {
            margin-left: 8px;
            color: #909399;
            cursor: pointer;
          }
        }

        .ranking-list {
          flex: 1;
          overflow-y: auto;

          .ranking-item {
            margin-bottom: 12px;

            &:last-child {
              margin-bottom: 0;
            }

            .rank-info {
              display: flex;
              align-items: center;
              margin-bottom: 6px;

              .rank-number {
                width: 22px;
                height: 22px;
                line-height: 22px;
                text-align: center;
                background: #f5f7fa;
                border-radius: 50%;
                margin-right: 8px;
                font-size: 12px;
                color: #606266;

                &.top-three {
                  background: linear-gradient(135deg, #FFD700, #FFA500);
                  color: #fff;
                }
              }

              .competitor-name {
                flex: 1;
                font-size: 13px;
                color: #606266;
                margin-right: 8px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
              }

              .value {
                font-size: 13px;
                color: #303133;
                font-weight: 500;
              }
            }

            .el-progress {
              margin-top: 4px;
            }
          }
        }
      }



    

  
    }
  }
}